#!/usr/bin/python

import sys
import dbus

if (len(sys.argv) < 2):
	print "Usage: %s <VPN connection id>" % (sys.argv[0])
	sys.exit(1)

bus = dbus.SystemBus()

manager = dbus.Interface(bus.get_object("net.connman.vpn", "/"),
					"net.connman.vpn.Manager")

connections = manager.GetConnections()

path = "/net/connman/vpn/connection/" + sys.argv[1]

print "Attempting to connect VPN %s" % (path)

connection = dbus.Interface(bus.get_object("net.connman.vpn", path),
					    "net.connman.vpn.Connection")

connection.Connect()
